//
//  RVideoIntroduceViewController.m
//  iAccountBook
//
//  Created by 侯伟 on 2021/8/27.
//

#import "RVideoIntroduceViewController.h"
#import "RSMutableLineTextItem.h"
#import "RVideoObj.h"

@interface RVideoIntroduceViewController ()

@property(nonatomic,strong)MyRelativeLayout* titleLayout;

/// 演员
@property(nonatomic,strong)RSMutableLineTextItem* performerItem;

/// 导演
@property(nonatomic,strong)RSMutableLineTextItem* directorItem;

/// 地区
@property(nonatomic,strong)RSMutableLineTextItem* areaItem;

/// 年代
@property(nonatomic,strong)RSMutableLineTextItem* yearItem;
@end

@implementation RVideoIntroduceViewController


- (void)loadView{
    [super loadView];
    
    MyLinearLayout* popView = [[MyLinearLayout alloc] initWithOrientation:(MyOrientation_Vert)];
    popView.backgroundColor = UIColor.whiteColor;
    popView.myHorzMargin = 0;
    popView.myBottom = 0;
    popView.myHeight = SCREEN_HEIGHT - PX(211)- IPHONE_TOP_SAFEINSET;
    [self.view addSubview:popView];
    self.popView = popView;


    MyRelativeLayout* titleLayout = [MyRelativeLayout new];
    titleLayout.padding = UIEdgeInsetsMake(0, 16, 0, 16);
    titleLayout.myHeight = PX(44.0);
    titleLayout.myMargin = 0;
    [popView addSubview:titleLayout];

    
    UILabel* titleLb1 = [UILabel lableWithFont:FONT_FIT(15) color:COLOR_BLACK_DARK text:@"简介"];
    titleLb1.myLeft = 0;
    titleLb1.myCenterY = 0;
    [titleLayout addSubview:titleLb1];
    
    UIButton* closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [closeBtn setImage:[UIImage imageNamed:@"details_close"] forState:UIControlStateNormal];
    [closeBtn addTarget:self action:@selector(closeClicked:) forControlEvents:UIControlEventTouchUpInside];
    closeBtn.mySize = CGSizeMake(32, 32);
    closeBtn.myCenterY = 0;
    closeBtn.myRight = 0;
    [titleLayout addSubview:closeBtn];

    //底部滚动控件
    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds];
    scrollView.showsHorizontalScrollIndicator = NO;
    scrollView.showsVerticalScrollIndicator = NO;
    scrollView.myMargin = 0;
    scrollView.weight = 1.0;
    [popView addSubview:scrollView];
    
    MyLinearLayout* contentLayout = [[MyLinearLayout alloc] initWithOrientation:(MyOrientation_Vert)];
    contentLayout.padding = UIEdgeInsetsMake(0, 16, 0, 16);
    contentLayout.myMargin = 0;
    contentLayout.heightSize.lBound(scrollView.heightSize, 10, 1);
    [scrollView addSubview:contentLayout];
    
    
    RSMutableLineTextItem* performerItem = [RSMutableLineTextItem itemWithTitle:@"主演："];
    performerItem.content = self.movie.actors;
    performerItem.titleColor = performerItem.contentColor = COLOR_GRAY_BASE;
    performerItem.titleFont = performerItem.contentFont = FONT_FIT(12);
    performerItem.myHorzMargin = 0;
    performerItem.myTop = 5;
    [contentLayout addSubview:performerItem];
    _performerItem = performerItem;
    
    RSMutableLineTextItem* directorItem = [RSMutableLineTextItem itemWithTitle:@"导演："];
    directorItem.content = self.movie.director;
    directorItem.titleColor = directorItem.contentColor = COLOR_GRAY_BASE;
    directorItem.titleFont = directorItem.contentFont = FONT_FIT(12);
    directorItem.myHorzMargin = 0;
    directorItem.myTop = 8;
    [contentLayout addSubview:directorItem];
    _directorItem = directorItem;
    
    RSMutableLineTextItem* areaItem = [RSMutableLineTextItem itemWithTitle:@"地区："];
    areaItem.content = self.movie.channel3_id;
    areaItem.titleColor = areaItem.contentColor = COLOR_GRAY_BASE;
    areaItem.titleFont = areaItem.contentFont = FONT_FIT(12);
    areaItem.myHorzMargin = 0;
    areaItem.myTop = 8;
    [contentLayout addSubview:areaItem];
    _areaItem = areaItem;
    
    RSMutableLineTextItem* yearItem = [RSMutableLineTextItem itemWithTitle:@"年代："];
    yearItem.content = self.movie.year;
    yearItem.titleColor = yearItem.contentColor = COLOR_GRAY_BASE;
    yearItem.titleFont = yearItem.contentFont = FONT_FIT(12);
    yearItem.myHorzMargin = 0;
    yearItem.myTop = 8;
    [contentLayout addSubview:yearItem];
    _yearItem = yearItem;
    
    UILabel* titleLb2 = [UILabel lableWithFont:FONT_FIT(15) color:COLOR_BLACK_DARK text:@"剧情介绍"];
    titleLb2.myHorzMargin = 0;
    titleLb2.myTop = 20;
    [contentLayout addSubview:titleLb2];
    
    UILabel* descLb = [UILabel lableWithFont:FONT_FIT(12) color:COLOR_GRAY_BASE text:self.movie.dess];
    descLb.myHorzMargin = 0;
    descLb.myTop = 5;
    descLb.myHeight = MyLayoutSize.wrap;
    [contentLayout addSubview:descLb];
}


- (void)viewDidLoad {
    [super viewDidLoad];
}

#pragma mark - Navigation
- (void)closeClicked:(UIButton *)sender {
    [self dismissActionSheetController:NULL];
    
    if (self.cancelBlockClick) {
        self.cancelBlockClick();
    }
}
@end
